package com.chen.utils;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chen.pojo.common.PageResult;

/**
 * @author chen
 * @version 1.0
 * @create_date 2025/8/17
 * 分页查询结果转换工具
 */
public class PageUtils {
    public static <T> PageResult<T> mapperResult(Page<T> page) {
        PageResult<T> result = new PageResult<>();
        result.setPageIndex(page.getCurrent());
        result.setPageSize(page.getSize());
        result.setTotalPage(page.getPages());
        result.setTotalCount(page.getTotal());
        result.setCurrentPageRecords(page.getRecords());
        return result;
    }
}
